#pragma once

#include <vector>
#include <boost/asio.hpp>
#include <tbb/scalable_allocator.h>


// Forward declaration
struct Header;


/// A reply to be sent to a client
struct Reply
{
	/// The status of the reply.
	enum StatusType
	{
		Ok = 200,
		Created = 201,
		Accepted = 202,
		NoContent = 204,
		MultipleChoices = 300,
		MovedPermanently = 301,
		MovedTemporarily = 302,
		NotModified = 304,
		BadRequest = 400,
		Unauthorized = 401,
		Forbidden = 403,
		NotFound = 404,
		InternalServerError = 500,
		NotImplemented = 501,
		BadGateway = 502,
		ServiceUnavailable = 503
	} status;

	/// The headers to be included in the reply
	std::vector<Header, tbb::scalable_allocator<Header> > headers;

	/// The content to be sent in the reply
	std::string content;

	/// Convert the reply into a vector of buffers. The buffers do not own the
	/// underlying memory blocks, therefore the reply object must remain valid and
	/// not be changed until the write operation has completed
	std::vector<boost::asio::const_buffer, tbb::scalable_allocator<boost::asio::const_buffer> > ToBuffers() const;

	/// Get a stock reply
	static Reply StockReply(StatusType status);
};
